//
//  MeHotViewController.m
//  MeLive
//
//  Created by liulei on 2017/5/2.
//  Copyright © 2017年 liulei. All rights reserved.
//

#import "MeHotViewController.h"

@interface MeHotViewController ()

@end

@implementation MeHotViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor grayColor];
    
    [self configNavItem];
}

- (void)configNavItem{
    
    //avatar按钮
    UIButton *avatarBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    avatarBtn.frame = CGRectMake(0, 0, 30, 30);
    [avatarBtn addTarget:self action:@selector(avatarBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    avatarBtn.backgroundColor = [UIColor clearColor];
    avatarBtn.titleLabel.textAlignment = NSTextAlignmentLeft;
    [avatarBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [avatarBtn setTitleColor:[UIColor colorWithWhite:1.0 alpha:0.6] forState:UIControlStateHighlighted];
    [avatarBtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
    UIBarButtonItem *btnLeftItem = [[UIBarButtonItem alloc] initWithCustomView:avatarBtn];
    self.navigationItem.leftBarButtonItem = btnLeftItem;
    SetBtnImages(avatarBtn, @"me_loading_avatar_126.png", nil);
    [avatarBtn drawCornerRadius:15];
    
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 180, 30)];
    titleLabel.font = [UIFont fontWithName:@"STHeitiSC-Light" size:18];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.text = @"互动直播";
    [self.navigationItem setTitleView:titleLabel];
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    
    btn.frame = CGRectMake(100, 200, 150, 50);
    
    [btn setTitle:@"kaisho" forState:UIControlStateNormal];
    btn.backgroundColor = [UIColor redColor];
    
    [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
}

- (void)avatarBtnClick:(UIButton *)avatarBtn{
    
}

- (void)btnClick{
    
    
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setObject:@"liulei" forKey:@"username"];
    [parameters setObject:@"哲昌" forKey:@"nickname"];
    [parameters setObject:@"123456" forKey:@"password"];
    [parameters setObject:@"ddd" forKey:@"avatar"];
    [parameters setObject:@"1" forKey:@"gender"];
    [parameters setObject:@"1990-01-23" forKey:@"dob"];
    
    SetHUDStartText(@"加载中");
    
    [MeUtil dictionary2JsonData:parameters];
    
    [MeNetworkHelper POST:@"http://api.cshuax.com/v1/user/register" parameters:parameters success:^(id responseObject) {
        NSLog(@";;;;;succ");
        SetHUDHidden;
    } failure:^(NSError *error) {
        SetHUDHidden;
        HUDShowRequestError(error.domain, self.view);
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
